﻿using PlaceOrder_Shared.Models.Trade;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace PlaceOrder_Core.PlaceOrderModels;

[Table("chat_receiver")]
public partial class ChatReceiver:UINotifyPropertyChanged
{
    [Column("target")]
    public string? Target { get; set; } = null;


    [Column("company")]
    public string Company { get; set; } = null!;

    [Column("tscode")]
    public string? Tscode { get; set; }

    [Column("chat_id")]
    public string ChatId { get; set; } = null!;

    [Column("deleted")]
    public bool? Deleted { get; set; }

    [Column("group_name")]
    public string? GroupName { get; set; }

    [Column("brokerid")]
    public short? Brokerid { get; set; }

    [Key]
    [Column("id")]
    public int Id { get; set; }

    /// <summary>
    /// 通道
    /// </summary>
    [Column("channel_id")]
    public string ChannelId { get; set; }


    [NotMapped] // 告诉 EFCore 不要将这个属性映射到数据库表的列
    public string FormattedTarget => $"{Company} - {Target}"; // 定义一个格式化后的文本属性

    [NotMapped] // 告诉 EFCore 不要将这个属性映射到数据库表的列
    public bool OrderInProgress { get; set; } = false;

    //[NotMapped] // 告诉 EFCore 不要将这个属性映射到数据库表的列
    //public bool IsDisabled { get; set; } = false;  // 该中介是否可用
    private bool _isDisabled;
    [NotMapped] // 告诉 EFCore 不要将这个属性映射到数据库表的列
    public bool IsDisabled
    {
        get { return _isDisabled; }
        set
        {
            if (_isDisabled != value)
            {
                _isDisabled = value;
                OnPropertyChanged();
            }
        }
    }
}
